/**
 * @file   EventConfirmationPacket.h
 * @author Djuro Drljaca (djurodrljaca@gmail.com)
 * @date   2014-04-26
 * @brief  DON packet object: Event Confirmation
 *
 * Copyright 2014  Djuro Drljaca (djurodrljaca@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef DON_CORE_PACKET_EVENTCONFIRMATIONPACKET_H
#define DON_CORE_PACKET_EVENTCONFIRMATIONPACKET_H

#include <DON/Core/Packet/AbstractPacket.h>
#include <DON/Core/Packet/ResponseStatus.h>

namespace DON
{
namespace Core
{
namespace Packet
{

/**
 * @brief The EventConfirmationPacket class
 */
class LIBDONQT4CORESHARED_EXPORT EventConfirmationPacket : public AbstractPacket
{
public:
    /**
     * @brief Constructor
     */
    EventConfirmationPacket();

    /**
     * @brief Constructor
     * @param source Packet's Source address
     * @param destination Packet's Destination address
     * @param sequence Sequence number
     * @param referenceSequence Sequence number from the request packet
     * @param responseStatus Response status (success or error code)
     */
    EventConfirmationPacket(const quint16 source,
                                   const quint16 destination,
                                   const quint16 sequence,
                                   const quint16 referenceSequence,
                                   const ResponseStatus responseStatus);

    /**
     * @brief Copy constructor
     * @param other Object to be copied
     */
    EventConfirmationPacket(const EventConfirmationPacket &other);

    /**
     * @brief Destructor
     */
    ~EventConfirmationPacket();

    /**
     * @brief Assignment operator
     * @param other Object to be copied
     * @return This object
     */
    EventConfirmationPacket & operator=(const EventConfirmationPacket &other);

    /**
     * @brief Checks if packet is valid
     * @retval true Packet is valid
     * @retval false Packet is not valid
     */
    bool isValid() const;

    /**
     * @brief Get reference sequence
     * @return Reference sequence
     */
    quint16 getReferenceSequence() const;

    /**
     * @brief Set reference sequence
     * @param referenceSequence New reference sequence
     */
    void setReferenceSequence(const quint16 referenceSequence);

    /**
     * @brief Get response status
     * @return Response status
     */
    ResponseStatus getResponseStatus() const;

    /**
     * @brief Set response status
     * @param responseStatus New response status
     */
    void setResponseStatus(const ResponseStatus responseStatus);

private:
    /**
     * @brief Get the packet's payload data items
     * @param[out] ok Error status output (true --> success, false --> error)
     * @return List of payload data items
     */
    QList<QByteArray> getPayloadDataItems(bool *ok = NULL) const;

    class Private;
    Private * const d;
};

}
}
}

#endif // DON_CORE_PACKET_EVENTCONFIRMATIONPACKET_H
